package com.yxy.springcloud.framework.unionauth.dao;

import com.yxy.springcloud.framework.common.base.MyMapper;
import com.yxy.springcloud.framework.unionauth.DTO.ChangePasswordForOuterDto;
import com.yxy.springcloud.framework.unionauth.model.AdminUser;
import com.yxy.springcloud.framework.unionauth.model.App;
import com.yxy.springcloud.framework.unionauth.model.Role;
import com.yxy.springcloud.framework.unionauth.model.Tenant;
import com.yxy.springcloud.framework.unionauth.vo.AdminUserExtend;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface AdminUserMapper extends MyMapper<AdminUser> {
  // 查询用户关联的租户列表
  List<Tenant> getTenantListWithUser(@Param("userId") Long userId);

  // 查询用户间接关联的app列表
  List<App> getAppListWithUser(@Param("userId") Long userId);

  // 查询用户关联的角色列表
  List<Role> getRoleListWithUser(@Param("userId") Long userId);

  // app user登录
  List<AdminUserExtend> login(@Param("username") String username, @Param("password") String password, @Param("appName") String appName);

  // 根据username和app code定位到某个具体的app user
  List<AdminUser> findUserByUsernameAndApp(ChangePasswordForOuterDto inputDto);

}
